package com.fxpc.hddc.activefault.jpa.dao.primary;


import com.fxpc.hddc.activefault.dto.primary.entity.EarthquakeDivision;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @Author Zyl
 * @Date 2021/3/31 17:22
 * @Version 1.0
 * @Describe:
 */
public interface EarthquakeDisivionRepository extends JpaRepository<EarthquakeDivision,String > {

    @Query(nativeQuery = true,value = "select user_code from earthquake_division where task_code= :taskCode and user_name like %:userName%")
    List<String> findCodeByTaskCodeAndName(@Param("taskCode")String taskCode, @Param("userName")String userName);

    /**
     * 查询当前数据库时间
     *
     * @return
     */
    @Query(nativeQuery = true, value = "select SYSDATE();")
    LocalDateTime getTimeNow();
}
